﻿using LNet;
using OestsCommon.Model;
using OestsServer.Net;

namespace OestsServer.Handlers.OESPHandlers
{
   
    public class ToUnityClientHandler : HandlerBase<OESPClientChannel>
    {
        /// <summary>
        ///
        /// </summary>
        /// <param name="client"></param>
        /// <param name="packet"></param>
        public override PacketKey PKey
        {
            get
            {
                return PacketKey.InterInvoke;
            }
        }


        public override void Execute(OESPClientChannel client, Request packet)
        {
            base.Execute(client, packet);//这里需要获取Unity来通信
            ClientChannel unityClient =  ServerController.Instance.UnityServerListener.ClientManager.GetClient(UserType.Student, client.User.DBid);
            if (unityClient != null)
            {
                ResponsePacket = new Response(packet);
                unityClient.Send(ResponsePacket);
            }
        }
    }

}
